﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System;
using System.ComponentModel.DataAnnotations;

namespace DNA.Mvc.Community
{
    /// <summary>
    /// Presents the attachement files of the post.
    /// </summary>
    [Table("community_attachments")]
    public class Attachment
    {
        [Key]
        public int ID { get; set; }

        /// <summary>
        /// Gets/Sets the PosID 
        /// </summary>
        [Required]
        public virtual int PostID { get; set; }

        /// <summary>
        /// Gets/Sets the attachment file mime type
        /// </summary>
        [MaxLength(50)]
        public virtual string ContentType { get; set; }

        /// <summary>
        /// Gets/Sets the attachment file name.
        /// </summary>
        [MaxLength(1024),Required]
        public virtual string FileName { get; set; }

        [ForeignKey("PostID")]
        public virtual Post Post { get; set; }
    }
}
